import 'package:flutter/material.dart';
import 'package:flutter_application_2/pages/home/tab_index/index_recommond_data.dart';
import 'package:flutter_application_2/widgets/common_image.dart';

var textStyle = TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600);

class IndexRecommondItemWidget extends StatelessWidget {
  final IndexRecommendItem data;

  const IndexRecommondItemWidget(this.data, {Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        print(data.navigateUri);
        Navigator.pushNamed(context, data.navigateUri);
      },
      child: Container(
        decoration: BoxDecoration(color: Colors.white),
        width: (MediaQuery.of(context).size.width - 10 * 3) / 2,
        height: 100.0,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(
                  data.title,
                  style: textStyle,
                ),
                Text(
                  data.subTitle,
                  style: textStyle,
                ),
              ],
            ),
            CommonImage(
              data.imageUri,
              width: 50.0,
              fit: BoxFit.fill,
            )
          ],
        ),
      ),
    );
  }
}
